<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <h:outputStylesheet library="css" name="layout.css"/>
        <link type="text/css" rel="stylesheet" href="#{request.contextPath}/resources/css/start/skin.css"/>
        <link type="text/css" rel="stylesheet" href="#{request.contextPath}/resources/css/default.css"/>


        <title>Transport Management Systems : <ui:insert name="title"/></title>
    </h:head>

    <h:body>

        <p:layout fullPage="true">
            <p:layoutUnit position="top" height="70" style="border: none">
                <div id="top" class="ui-widget ui-widget-header" style="height: 70px;">
                    <div style="float: left;">Transport Management Systems</div>
                    <div style="float: right;width: 200px;text-align: right;margin-right: 10px;padding-top: 20px;">
                        <h:form>                            
                            <span style="font-size: small;font-style: normal"> #{request.userPrincipal.name}</span>
                            <b>|</b>
                            <p:commandLink action="#{loginBean.logout}" value="Logout"/>
                        </h:form>
                    </div>
                </div>
            </p:layoutUnit>

            <p:layoutUnit position="bottom" height="35" style="border: none">
                <div id="footer" class="ui-widget ui-widget-header" style="height: 35px;padding-bottom: 2px;">
                    <p class="copyright">&nbsp;&copy;Copyright 2010. All rights reserved</p>
                </div>
            </p:layoutUnit>

            <p:layoutUnit position="left" width="240" scrollable="true">
                <h:form>                    
                    <p:menu style="width:200px; border: none;margin-left: 5px;" autoSubmenuDisplay="true" clickToHide="true">

                        <p:submenu label="Prepare" >
                            <p:menuitem value="Invoice"
                                        action="#{invoiceBean.prepareCreate}"/>                            

                            <p:menuitem value="Shipping Manifesto "
                                        action="#{shippingBean.prepareCreate}"/>
                        </p:submenu>

                        <p:submenu label="Users" rendered="#{request.isUserInRole('administrator')}" >
                            <p:menuitem value="List" 
                                        url="/users"/>
                            <p:menuitem value="Add"
                                        url="/users/add"/>
                        </p:submenu>
                        <p:submenu label="Customers">
                            <p:menuitem value="List"
                                        url="/customers"/>
                            <p:menuitem value="Add"
                                        url="/customers/add"/>
                        </p:submenu>
                        <p:submenu label="Trucks">
                            <p:menuitem value="List"
                                        url="/trucks"/>
                            <p:menuitem value="Add"
                                        url="/trucks/add"/>
                        </p:submenu>
                        <p:submenu label="Drivers">
                            <p:menuitem value="List"
                                        url="/drivers"/>
                            <p:menuitem value="Add"
                                        url="/drivers/add"/>

                        </p:submenu>
                        <p:submenu label="Preferences">
                            <p:menuitem value="Change Password" onclick="changePassword.show();"/>
                        </p:submenu>

                    </p:menu>

                </h:form>
            </p:layoutUnit>

            <p:layoutUnit position="center" scrollable="true">
                <ui:insert name="content">Content</ui:insert>
            </p:layoutUnit>
        </p:layout>
        <p:dialog header="Change Password" widgetVar="changePassword" modal="true" height="150">

            <h:form>
                <br/>
                <h:panelGrid columns="3">

                    <h:outputLabel value="Password" for="passwd" />
                    <p:password id="passwd" value="#{userBean.loggedInUser.password}" minLength="6" requiredMessage="*" required="true"/>
                    <p:message for="passwd" />
                    <h:outputLabel value=" " />
                    <h:outputLabel value=" " />
                    <h:outputLabel value=" " />
                    <h:outputLabel value=" " />
                    <p:commandButton value="Update" action="#{userBean.changePassword}" ajax="false"/>
                    <h:outputLabel value=" " />
                </h:panelGrid>


            </h:form>
        </p:dialog>
    </h:body>

</html>
